﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Fcdbas.WinUI.Forms;

using Fcdbas.Platform.Interface;
using Fcdbas.WinUI.Common;
using Fcdbas.Core.Windows;
using Fcdbas.WinUI.Windows;
using Fcdbas.Platform.Properties;
using Fcdbas.Platform;
using Fcdbas.WinUI.Controls;
using Fcdbas.Core;

namespace Fcdbas.WinUI.Forms
{
    public partial class dlgOptions : cDialogWindow
    {
        private frmMainForm mainForm;
        public dlgOptions(frmMainForm frm)
        {
            InitializeComponent();
            mainForm = frm;
        }
        private void AddAlignToComboBox(cComboBox cmbBox)
        {
            cmbBox.ClearItem();
            cmbBox.AddItem(DevExpress.Utils.HorzAlignment.Default, "默认");
          //  cmbBox.Properties.Items.Add("默认");

            cmbBox.AddItem(DevExpress.Utils.HorzAlignment.Center, "居中");
           // cmbBox.Properties.Items.Add("居中");

            cmbBox.AddItem(DevExpress.Utils.HorzAlignment.Far, "右边");
          //  cmbBox.Properties.Items.Add("右边");

            cmbBox.AddItem(DevExpress.Utils.HorzAlignment.Near, "左边");
          //  cmbBox.Properties.Items.Add("左边");
        }

        private void dlgOptions_Load(object sender, EventArgs e)
        {
            AddAlignToComboBox(this.cbDateAlign);
            AddAlignToComboBox(this.cbNumberAlign);
            AddAlignToComboBox(this.cbStringAlign);
            this.MasterdataSourceBinding.DataSource = AppEnvironment.AppOption;
            this.MasterdataSourceBinding.ResetBindings(false);
        }

        private void btnCurrentPage_Click(object sender, EventArgs e)
        {
            BaseForm form = mainForm.CurrentForm;
            if (form != null && form.Tag != null)
                txtDefaultHome.Text = mainForm.CurrentForm.Tag.ToString();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            AppEnvironment.SaveOption();
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }

        private void cComboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }
}
